// import { getAllRoleList, isAccountExist } from '@/api/demo/system';
import { BasicColumn, FormSchema } from '@/components/Table';
import { useI18n } from "@/hooks/web/useI18n";

const { t } = useI18n();
/**
 * transform mock data
 * {
 *  0: '华东分部',
 * '0-0': '华东分部-研发部'
 * '0-1': '华东分部-市场部',
 *  ...
 * }
 */
// export const deptMap = (() => {
//   const pDept = ['华东分部', '华南分部', '西北分部'];
//   const cDept = ['研发部', '市场部', '商务部', '财务部'];

//   return pDept.reduce((map, p, pIdx) => {
//     map[pIdx] = p;

//     cDept.forEach((c, cIndex) => (map[`${pIdx}-${cIndex}`] = `${p}-${c}`));

//     return map;
//   }, {});
// })();
//表头数据
export const columns: BasicColumn[] = [
  {
    title: 'id',
    dataIndex: 'taskId',
    width: 120,
  },
  {
    title: t('sys.orientation.keyword'),
    dataIndex: 'keyword',
    width: 120,
  },

  {
    title: t('sys.informaionMatchaing.columns.createTime'),
    dataIndex: 'createTime',
    width: 120,
  },
  {
    title: t('sys.script.columns.creadTime'),
    dataIndex: 'startTime',
    width: 120,
  },
  {
    title: '当前节点数',
    dataIndex: 'currentNode',
    width: 120,
  },
  {
    title: t('sys.orientation.maxNode'),
    dataIndex: 'maxNode',
    width: 120,
  },
  {
    title: '分发数',
    dataIndex: 'distribute',
    width: 120,
  },
  {
    title: '最小数',
    dataIndex: 'minNum',
    width: 120,
  },
  {
    title: '总数',
    dataIndex: 'maxNum',
    width: 120,
  },
  {
    title: '成功数',
    dataIndex: 'success',
    width: 120,
  },

  {
    title: t('sys.analysis.columns.status'),
    dataIndex: 'status',
    width: 120,
    customRender: ({ text }) => {
      switch (text) {
        case 0:
          return '正在进行';
        case 1:
          return '完成';
        case 2:
          return '停用';
        default:
          return t('sys.code.columns.unknownState');
      }
    },
  },

  // {
  //   title: 'ZK推送',
  //   dataIndex: '',
  //   width: 120,
  // },
];
//表头搜素数据
export const searchFormSchema: FormSchema[] = [
  {
    field: 'id',
    label: t('sys.informaionMatchaing.columns.createUsername'),
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'nickname',
    label: t('sys.device.columns.time'),
    component: 'Input',
    colProps: { span: 4 },
  },
];

export const accountFormSchema: FormSchema[] = [
  // {
  //   field: 'keyWord',
  //   component: 'Input',
  //   label: t('sys.orientation.keyword'),
  //   /**!!!renderColContent 没有FormItem 包裹, 若想要 Form 提交需要带上数据须 <FormItem name={}></FormItem> 包裹： 示例如下*/
  //   colSlot: 'colSlot_field5',
  //   colProps: {
  //     span: 24,
  //   },
  //   dynamicDisabled: ({ values }) => {
  //     return !!values.field_disabled;
  //   },
  // },
  {
    field: 'keyWord',
    component: 'Input',
    label: t('sys.orientation.keyword'),
    defaultValue: '',
    colProps: {
      span: 24,
    },
    rules: [{ required: true }],
  },
  {
    field: 'maxNum',
    component: 'Input',
    label: '所需数量',
    defaultValue: '',
    colProps: {
      span: 24,
    },
    rules: [{ required: true }],
  },
  {
    field: 'startTime',
    component: 'DatePicker',
    label: t('sys.script.columns.creadTime'),
    defaultValue: '',
    colProps: {
      span: 24,
    },
    componentProps: {
      format: 'YYYY-MM-DD HH:mm:ss', // 设置日期格式包含时分秒
      showTime: true, // 显示时间选择器
    },
    rules: [{ required: true }],
  },
];
